! elliptisches Prisma 1/4 mit Loch
! version 1.0 ! date: 92.2.15
!  1992 Stefan Felber ,Vienna (TEL: 43-58-473)
! internal macros : -

! a = lenght 
! b = width 
! c = height
! d = smoothness
! e = visibility Mask
! f = hole.left
! g = hole.right
! h = hole.top
! i = hole.bottom

! *** shift variables for working
m=f
n=g
o=h
p=i

addz -c/2
! *** loop of prisms
for i=0 to d-1
      v = cos((i+1)*90/d)*a			! *** sector.left
			w = sin((i+1)*90/d)*b			! *** width at sector.left
      x = cos( i*90/d)*a						! *** sector.right	
			y = sin( i*90/d)*b						! *** width at sector.right	

			k = (y-w)/(x-v) 							! *** ascent
			r = max(v,m)									 ! *** hole.left
			s = w+(r-v)*k									! *** width at hole.left
			t = min(x,n)										 ! *** hole.right
			u = w+(t-v)*k									! *** width at hole.right	

																						! *** right visibility Mask
			if (i=0) then 201
					l =0
			goto 202
			201:
					l = 15
			202:

																						! *** left visibility Mask
			if (i= (d-1)) then 203
					j = 0
			goto 204
			203:
					j = 15
			204:
	
			if  (((m<v) and (v<n)) or ((m<x) and (x<n))) and (s>p) then 219
			PRISM_ 4,c,    ! ***  entire ellipse-sector prism
					v, w,j,
					v,0,15,
					x,0,l,
					x, y,15
			goto 299:

			219:	
			if not ((v<m) and (m<x)) then 229
			PRISM_ 7,c,    ! ***  long prism left
					v, w,j,
					v,0,15,
					r,0,l,
					r, max(p,0),15,
					r, min(o,s),l,
					r, s,15,
					v, w,15
				j=0
			229:

			if not ((v<n) and (n<x)) then 239
			PRISM_ 6,c,    ! ***  long prism right
					t, u,j,
					t, min(o,u),15,
					t, max(p,0),j,
					t,0,15,
					x,0,l,
					x, y,15
					l = 0
			239:

			if (p <= 0) then 249						! *** no bottom ellipse-sectors
			if (s>p) and (u>p) then 240	! *** hole.bottom inside the ellipse-sector
		
			z = (p-w)/k+v										! *** hole.bottom cuts the ellipse-sector
			PRISM_ 5,c,    ! ***  short prism bottom
					r, p,j,
					r,0,15,
					t,0,l,
					t, u,15,
					z, p,15
			goto 249
			240:
			PRISM_ 4,c,    ! ***  short prism bottom
					r, p,j,
					r,0,15,
					t,0,l,
					t, p,15
			249:

			if (s<=o) and (u<=o) then 259	! *** no top ellipse-sector
			if (s>o) and (u>o) then 250	! *** hole.top inside the ellipse-sector
		
					z = (o-w)/k+v								! *** hole.top cuts the ellipse-sector
			PRISM_ 3,c,    ! ***  short prism top
					r, s,j,
					r,o,15,
					z,o,15
			goto 259
			250:
			PRISM_ 4,c,    ! ***  short prism top
					r, s,j,
					r,o,15,
					t,o,l,
					t, u,15
			259:

			299:
      next i

! *** debug 888:

